#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] != i + '0') {
      cout << char(i + '0') << endl;
      return 0;
    }
  }
  cout << '9' << endl;
}
